#ifndef __UART_H__
#define __UART_H__

#include <stdint.h>
#include "usart.h"
#include <stdbool.h>

#define DEBUG_RX_SIZE 4096
#define DEBUG_RX_MAX 1200
#define DEBUG_RX_COUNT 3

#define DEBUG_TX_SIZE 2048
#define DEBUG_TX_MAX 256
#define DEBUG_TX_COUNT 10



typedef struct{
	uint8_t  *start;
	uint8_t  *end;
}location_s;

typedef struct{
	uint32_t  RxCounter;
	uint32_t  TxCounter;
	uint32_t  TxState;
	location_s RxLocation[10];
	location_s  TxLocation[10];
	location_s *RxInPtr;
	location_s *RxOutPtr;
	location_s *RxEndPtr;
	location_s *TxInPtr;
	location_s *TxOutPtr;
	location_s *TxEndPtr;
}uart_s;

extern uart_s debug_uart;

void debug_uart_init(void);
void debug_printf(char *format,...);
void debug_uart_tx_data(uint8_t *data,uint32_t datalen);
bool debug_uart_rx_data(uint8_t *data,uint16_t *datalen);
void debug_uart_tx_data_loop(void);

#endif
